package com.qf.fanwang.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.fanwang.pojo.User;
import com.qf.fanwang.service.UserService;
import com.qf.fanwang.service.impl.UserServiceImpl;

import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/user")
public class UserController extends BaseController {
    private UserService us=new UserServiceImpl();

    //@Override
    protected String show(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PageHelper.startPage(1,4);//设置首页和每页的行数
        List<User> list=us.selectAll();//查询数据
        PageInfo<User> pageInfo=new PageInfo<>(list);
       // pageInfo.setList(list);//将查询的数据存放在pageInfo中
        req.setAttribute("plist",pageInfo);
       //req.setAttribute("ulist",list);
        //req.getRequestDispatcher("usershow.jsp").forward(req,resp);
        return "forward:usershow";
    }
}
